<!DOCTYPE html>
<html> 
 <head> 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
  <script type="text/javascript" src="/static/js/jquery.min.js"></script> 
  <title>登录</title> 
  </head> 
  <body> 错误信息：
   <h4 id="erro"></h4> 
  <form> 
  		<p> 账号：<input type="text" name="username" id="username"  /> </p> 
 	 	<p> 密码：<input type="text" name="password" id="password" /> </p>
   		<p> 
   			<input type="button" id="ajaxLogin" value="登录" />
   			<input type="button" id="loginOut" value="退出" />    			
   		 </p> 
   		
   </form> 
   <form> 
  		<p> 账号：<input type="text" name="phone" id="phone"  /> </p> 
 	 	<p> 密码：<input type="text" name="password" id="pwd" /> </p>
   		<p> 
   			<input type="button" id="ajaxRegs" value="注册" />   			   			
   		 </p> 
   		
   </form> 
   
   <form> 
  		<p> 账号：<input type="text" name="phone" id="phone1"  /> </p> 
 	 	<p> 密码：<input type="text" name="password" id="pwd1" /> </p>
 	 	<p> 密码：<input type="text" name="verificationCode" id="verificationCode" /> </p>
   		<p> 
   			<input type="button" id="updatePwd" value="密码修改" />   
   			<input type="button" id="sendMsg" value="发送短信" />   				   			
   		 </p> 
   		
   </form> 
   </body>
   <script> 
   		
   		$("#ajaxLogin").click(function() {
   			var username = $("#username").val(); 
   	   		var password = $("#password").val(); 
   	 	  	
   	   	
   			$.post(
   					"/sysuser/ajaxLogin", 
   					{ "phone" : username, "password" : password }, 
   					function(result) { 
   						if (result.code == "SUCCESS") { 
   							location.href = "/index"; 
   						} 
	   					else { 
	   						$("#erro").html(result.msg); 
	   					} 
   				});
   		});
   		$("#loginOut").click(function() {
   			$.get(
   					"/logout",  
   					null,
   					function(result) {
   						alert("ss");
   						 $("#erro").html(result.message); 
   					
   				});
   		});
   		
   		
		$("#ajaxRegs").click(function() {
   			var phone = $("#phone").val(); 
   	   		var password = $("#pwd").val(); 
   			$.post(
   					"/sysuser/ajaxRegs", 
   					{ "phone" : phone, "password" : password }, 
   					function(result) { 
   						if (result.code == "SUCCESS") { 
   							location.href = "/loginPage"; 
   						} 
	   					else { 
	   						$("#erro").html(result.msg); 
	   					} 
   				});
   		});
		
		
		$("#updatePwd").click(function() {
   			var phone = $("#phone1").val(); 
   	   		var password = $("#pwd1").val(); 
   	   		var verificationCode = $("#verificationCode").val(); 
   	   		var oldPwd="666666";
   			$.post(
   					"/sysuser/modifyPwd", 
   					{ "phone" : phone, "password" : password ,"verificationCode":verificationCode,"id":"1","oldPwd":oldPwd}, 
   					function(result) { 
   						if (result.code == "SUCCESS") { 
   							alert(result.msg);
   						} 
	   					else { 
	   						$("#erro").html(result.msg); 
	   					} 
   				});
   		});
   		
		$("#sendMsg").click(function() {   			
   			$.post(
   					"/msg/sendMsg", 
   					{ "phone" : "15013421554"}, 
   					function(result) { 
   						if (result.code == "SUCCESS") { 
   							alert(result.msg);
   						} 
	   					else { 
	   						$("#erro").html(result.msg); 
	   					} 
   				});
   		});
   	</script>  
</html>

